/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.dengues.model.database.util;

import java.util.List;

import org.dengues.model.database.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.dengues.model.database.DatabasePackage
 * @generated
 */
public class DatabaseSwitch {
    /**
     * The cached model package
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected static DatabasePackage modelPackage;

    /**
     * Creates an instance of the switch.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public DatabaseSwitch() {
        if (modelPackage == null) {
            modelPackage = DatabasePackage.eINSTANCE;
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    public Object doSwitch(EObject theEObject) {
        return doSwitch(theEObject.eClass(), theEObject);
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected Object doSwitch(EClass theEClass, EObject theEObject) {
        if (theEClass.eContainer() == modelPackage) {
            return doSwitch(theEClass.getClassifierID(), theEObject);
        }
        else {
            List eSuperTypes = theEClass.getESuperTypes();
            return
                eSuperTypes.isEmpty() ?
                    defaultCase(theEObject) :
                    doSwitch((EClass)eSuperTypes.get(0), theEObject);
        }
    }

    /**
     * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @return the first non-null result returned by a <code>caseXXX</code> call.
     * @generated
     */
    protected Object doSwitch(int classifierID, EObject theEObject) {
        switch (classifierID) {
            case DatabasePackage.DB_TABLE: {
                DBTable dbTable = (DBTable)theEObject;
                Object result = caseDBTable(dbTable);
                if (result == null) result = caseDiagramChild(dbTable);
                if (result == null) result = caseAbstractDBObject(dbTable);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DB_COLUMN: {
                DBColumn dbColumn = (DBColumn)theEObject;
                Object result = caseDBColumn(dbColumn);
                if (result == null) result = caseDiagramChild(dbColumn);
                if (result == null) result = caseAbstractDBObject(dbColumn);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DATABASE_DIAGRAM: {
                DatabaseDiagram databaseDiagram = (DatabaseDiagram)theEObject;
                Object result = caseDatabaseDiagram(databaseDiagram);
                if (result == null) result = caseAbstractDBObject(databaseDiagram);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.FOREIGN_KEY: {
                ForeignKey foreignKey = (ForeignKey)theEObject;
                Object result = caseForeignKey(foreignKey);
                if (result == null) result = caseAbstractDBObject(foreignKey);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DB_NOTE: {
                DBNote dbNote = (DBNote)theEObject;
                Object result = caseDBNote(dbNote);
                if (result == null) result = caseDiagramChild(dbNote);
                if (result == null) result = caseAbstractDBObject(dbNote);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.DIAGRAM_CHILD: {
                DiagramChild diagramChild = (DiagramChild)theEObject;
                Object result = caseDiagramChild(diagramChild);
                if (result == null) result = caseAbstractDBObject(diagramChild);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.ABSTRACT_DB_OBJECT: {
                AbstractDBObject abstractDBObject = (AbstractDBObject)theEObject;
                Object result = caseAbstractDBObject(abstractDBObject);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_COLUMNS: {
                SectionColumns sectionColumns = (SectionColumns)theEObject;
                Object result = caseSectionColumns(sectionColumns);
                if (result == null) result = caseAbstractDBObject(sectionColumns);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_FILTERS: {
                SectionFilters sectionFilters = (SectionFilters)theEObject;
                Object result = caseSectionFilters(sectionFilters);
                if (result == null) result = caseAbstractDBObject(sectionFilters);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_GROUPS: {
                SectionGroups sectionGroups = (SectionGroups)theEObject;
                Object result = caseSectionGroups(sectionGroups);
                if (result == null) result = caseAbstractDBObject(sectionGroups);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_SORTS: {
                SectionSorts sectionSorts = (SectionSorts)theEObject;
                Object result = caseSectionSorts(sectionSorts);
                if (result == null) result = caseAbstractDBObject(sectionSorts);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_HAVINGS: {
                SectionHavings sectionHavings = (SectionHavings)theEObject;
                Object result = caseSectionHavings(sectionHavings);
                if (result == null) result = caseAbstractDBObject(sectionHavings);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.SECTION_UNIONS: {
                SectionUnions sectionUnions = (SectionUnions)theEObject;
                Object result = caseSectionUnions(sectionUnions);
                if (result == null) result = caseAbstractDBObject(sectionUnions);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case DatabasePackage.FOREIGN_KEY_LABEL: {
                ForeignKeyLabel foreignKeyLabel = (ForeignKeyLabel)theEObject;
                Object result = caseForeignKeyLabel(foreignKeyLabel);
                if (result == null) result = caseDiagramChild(foreignKeyLabel);
                if (result == null) result = caseAbstractDBObject(foreignKeyLabel);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            default: return defaultCase(theEObject);
        }
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Table</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Table</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseDBTable(DBTable object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Column</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Column</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseDBColumn(DBColumn object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Diagram</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Diagram</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseDatabaseDiagram(DatabaseDiagram object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Foreign Key</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Foreign Key</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseForeignKey(ForeignKey object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>DB Note</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>DB Note</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseDBNote(DBNote object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Diagram Child</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Diagram Child</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseDiagramChild(DiagramChild object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Abstract DB Object</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Abstract DB Object</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseAbstractDBObject(AbstractDBObject object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Columns</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Columns</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionColumns(SectionColumns object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Filters</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Filters</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionFilters(SectionFilters object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Groups</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Groups</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionGroups(SectionGroups object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Sorts</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Sorts</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionSorts(SectionSorts object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Havings</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Havings</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionHavings(SectionHavings object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Section Unions</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Section Unions</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseSectionUnions(SectionUnions object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>Foreign Key Label</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>Foreign Key Label</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
     * @generated
     */
    public Object caseForeignKeyLabel(ForeignKeyLabel object) {
        return null;
    }

    /**
     * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
     * <!-- begin-user-doc -->
     * This implementation returns null;
     * returning a non-null result will terminate the switch, but this is the last case anyway.
     * <!-- end-user-doc -->
     * @param object the target of the switch.
     * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
     * @see #doSwitch(org.eclipse.emf.ecore.EObject)
     * @generated
     */
    public Object defaultCase(EObject object) {
        return null;
    }

} //DatabaseSwitch
